package com.itheima.utils;

import java.util.ArrayList;
import java.util.Random;

public class ArrayTools{
    static ArrayList<Integer> random = new ArrayList<>();
    static Random r = new Random();
    static {
        for (int i = 1000; i < 10000; i++) {
            random.add(i);
        }
    }
     /**
     *
     */
    public static int[] getRandomList(int listLength){
        int[] arr = new int[listLength];
        for (int i = 0; i < arr.length; i++) {
            arr[i] = random.remove(r.nextInt(random.size()));
        }
        return arr;
    }

    /**
     *
     */
    public static <E> E[] reverList(E[] e){
//        E[] arr1 = new E[e.length];
        ArrayList<E> list = new ArrayList<>();
        for (int i = e.length - 1; i >= 0; i--) {
            list.add(e[i]);
        }
        return list.toArray(e);
    }
}

